﻿<#include "../common.html" />
<!DOCTYPE HTML>
<html>
<body>
<article class="cl pd-20">
	<form action="/createCode/createCodeFile" method="post" class="form form-horizontal" id="form-add">
		<div class="row cl">
			<label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>模块说明：</label>
			<div class="formControls col-xs-8 col-sm-8">
				<input type="text" class="input-text" value="" placeholder="" id="description" name="description">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-2 col-sm-2">Server包名：</label>
			<div class="formControls col-xs-3 col-sm-3">
				<input type="text" class="input-text" value="" placeholder="请使用纯字母,标准驼峰命名" id="packageName" name="packageName">
			</div>
			<label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>Web包名：</label>
			<div class="formControls col-xs-3 col-sm-3">
				<input type="text" class="input-text" value="operate" placeholder="请使用纯字母,标准驼峰命名" id="webPackageName" name="webPackageName">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>处理类名：</label>
			<div class="formControls col-xs-4 col-sm-4">
				<input type="text" class="input-text" value="" placeholder="首字母必须大写" id="objectName" name="objectName">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-2 col-sm-2">表前缀：</label>
			<div class="formControls col-xs-4 col-sm-4">
				<input type="text" class="input-text" value="" placeholder="" id="tableTop" name="tableTop">
			</div>
		</div>
		<!--<div class="row cl">-->
			<!--<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">-->
				<!--<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">-->
			<!--</div>-->
		<!--</div>-->
		<div class="cl pd-5 bg-1 bk-gray"> <span class="l"> <a href="javascript:;" onclick="layer_show('代码生成器','goAddAttr','650','400')" class="btn btn-primary radius">新增属性</a>
			<a class="btn btn-success radius" href="javascript:;" onclick="create()">生成</a> </span> </div>
		<div class="mt-20">
			<table class="table table-border table-bordered table-hover table-bg table-sort" id="example">
				<thead>
				<tr class="text-c">
					<th width="30">序号</th>
					<th width="80">属性名</th>
					<th width="40">类型</th>
					<th width="40">长度</th>
					<th width="">备注</th>
					<th width="60">前台录入</th>
					<th width="60">默认值</th>
					<th width="100">操作</th>
				</tr>
				</thead>
				<tbody id="fields">

				</tbody>
			</table>
		</div>
	</form>
</article>

<script type="text/javascript">
	var index = 1;
	function addField(name,type,length,remark,isInput,defaultVal,uuid){
		var inputVal = "";
		if(isInput==1){
			inputVal = "是";
		}else{
			inputVal = "否";
		}
//		alert(Math.uuid(10));
		$("#fields").append(
				'<tr class="text-c" id="'+uuid+'">'+
				'<td>'+Number(index)+'</td>'+
				'<td>'+name+'<input type="hidden" name="attrNames" value="'+name+'"></td>'+
				'<td>'+type+'<input type="hidden" name="attrTypes" value="'+type+'"></td>'+
				'<td>'+length+'<input type="hidden" name="attrLengths" value="'+length+'"></td>'+
				'<td>'+remark+'<input type="hidden" name="attrRemarks" value="'+remark+'"></td>'+
				'<td>'+inputVal+'<input type="hidden" name="isInputs" value="'+isInput+'"></td>'+
				'<td>'+defaultVal+'<input type="hidden" name="defaultVals" value="'+defaultVal+'"></td>'+
				'<td class="td-manage">'+
				'<a title="编辑" href="javascript:;"  onclick="layer_show(\'代码生成器\',\'goEditAttr?uuid='+uuid+'&name='+name+'&type='+type+'&length='+length+'&remark='+remark+'&isInput='+isInput+'&defaultVal='+defaultVal+'\',\'650\',\'400\')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>'+
				'<a title="删除" href="javascript:;" onclick="removeField(this)" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>'+
				'</td>'+
				'</tr>'
		);
		index++;
		$("#zindex").val(index);
	}

	function removeField(t){
		var tr = $(t).parent().parent();
		tr.remove();
		$('.text-c').each(function(i){
			//循环每一个tr，给每行序号重新赋值
			if(i!=0){
				$(this).find('td:first').text(i);
			}

		});
		index--;
	}

	function create(){
		$("#form-add").submit();
	}
</script>
</body>
</html>